package com.codegeek.project.slope.service.impl;

import com.codegeek.project.slope.domain.SlopeSubscriber;
import com.codegeek.project.slope.mapper.SlopeSubscriberMapper;
import com.codegeek.project.slope.service.ISlopeSubscriberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 订阅人Service业务层处理
 *
 * @author codegeek
 * @date 2020-02-04
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class SlopeSubscriberServiceImpl implements ISlopeSubscriberService {
    @Autowired
    private SlopeSubscriberMapper slopeSubscriberMapper;

    /**
     * 查询订阅人
     *
     * @param subscriberId 订阅人ID
     * @return 订阅人
     */
    @Override
    public SlopeSubscriber selectSlopeSubscriberById(Long subscriberId) {
        return slopeSubscriberMapper.selectSlopeSubscriberById(subscriberId);
    }

    /**
     * 查询订阅人列表
     *
     * @param slopeSubscriber 订阅人
     * @return 订阅人
     */
    @Override
    public List<SlopeSubscriber> selectSlopeSubscriberList(SlopeSubscriber slopeSubscriber) {
        return slopeSubscriberMapper.selectSlopeSubscriberList(slopeSubscriber);
    }

    /**
     * 新增订阅人
     *
     * @param slopeSubscriber 订阅人
     * @return 结果
     */
    @Override
    public int insertSlopeSubscriber(SlopeSubscriber slopeSubscriber) {
        return slopeSubscriberMapper.insertSlopeSubscriber(slopeSubscriber);
    }

    /**
     * 修改订阅人
     *
     * @param slopeSubscriber 订阅人
     * @return 结果
     */
    @Override
    public int updateSlopeSubscriber(SlopeSubscriber slopeSubscriber) {
        return slopeSubscriberMapper.updateSlopeSubscriber(slopeSubscriber);
    }

    /**
     * 批量删除订阅人
     *
     * @param subscriberIds 需要删除的订阅人ID
     * @return 结果
     */
    @Override
    public int deleteSlopeSubscriberByIds(Long[] subscriberIds) {
        return slopeSubscriberMapper.deleteSlopeSubscriberByIds(subscriberIds);
    }

    /**
     * 删除订阅人信息
     *
     * @param subscriberId 订阅人ID
     * @return 结果
     */
    @Override
    public int deleteSlopeSubscriberById(Long subscriberId) {
        return slopeSubscriberMapper.deleteSlopeSubscriberById(subscriberId);
    }

    /**
     * 修改用户状态
     *
     * @param slopeSubscriber
     * @return
     */
    @Override
    public int updateSlopeSubscriberStatus(SlopeSubscriber slopeSubscriber) {
        return slopeSubscriberMapper.updateSlopeSubscriberStatus(slopeSubscriber);
    }

    /**
     * 批量禁用
     *
     * @param ids
     * @return
     */
    @Override
    public int selectedDisable(List<Long> ids) {
        return slopeSubscriberMapper.selectedDisable(ids);
    }


}
